<html>
<head><meta charset="utf-8"><title>const equality + wf · t-lang · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/index.html">t-lang</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20equality.20.2B.20wf.html">const equality + wf</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="205628249"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20equality%20%2B%20wf/near/205628249" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20equality.20.2B.20wf.html#205628249">(Jul 31 2020 at 18:55)</a>:</h4>
<p><a href="https://hackmd.io/OZG_XiLFRs2Xmw5s39jRzA?view">https://hackmd.io/OZG_XiLFRs2Xmw5s39jRzA?view</a></p>
<p>I tried to make a quick design doc for const wf bounds and equality, not sure what to do with this <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span></p>



<a name="205628456"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20equality%20%2B%20wf/near/205628456" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20equality.20.2B.20wf.html#205628456">(Jul 31 2020 at 18:57)</a>:</h4>
<p>Is this too complex for a lang MCP?</p>



<a name="205628540"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20equality%20%2B%20wf/near/205628540" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20equality.20.2B.20wf.html#205628540">(Jul 31 2020 at 18:58)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> <span class="user-mention" data-user-id="256759">@boats</span></p>



<a name="205628864"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20equality%20%2B%20wf/near/205628864" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20equality.20.2B.20wf.html#205628864">(Jul 31 2020 at 19:01)</a>:</h4>
<p>A huge thanks to <span class="user-mention" data-user-id="124288">@oli</span> for designing this with me in <a href="#narrow/stream/146212-t-compiler.2Fconst-eval/topic/const.20wf.20bounds.20implementation">https://rust-lang.zulipchat.com/#narrow/stream/146212-t-compiler.2Fconst-eval/topic/const.20wf.20bounds.20implementation</a>. The good here was made thanks to him and errors are my own <span aria-label="sparkles" class="emoji emoji-2728" role="img" title="sparkles">:sparkles:</span></p>



<a name="205630147"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20equality%20%2B%20wf/near/205630147" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20equality.20.2B.20wf.html#205630147">(Jul 31 2020 at 19:14)</a>:</h4>
<p>This also doesn't really talk about how we can implement this, for that a good summary might be <a href="https://hackmd.io/z7LKv6WKRkiw2WC7KDkvYw#Implementation">https://hackmd.io/z7LKv6WKRkiw2WC7KDkvYw#Implementation</a></p>



<a name="205632715"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20equality%20%2B%20wf/near/205632715" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20equality.20.2B.20wf.html#205632715">(Jul 31 2020 at 19:37)</a>:</h4>
<p>I'm not sure if an MCP is needed if it's kind of "part of const generics", but this is great regardless</p>



<a name="205632741"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20equality%20%2B%20wf/near/205632741" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20equality.20.2B.20wf.html#205632741">(Jul 31 2020 at 19:37)</a>:</h4>
<p>I'll skim over it</p>



<a name="205640894"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20equality%20%2B%20wf/near/205640894" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20equality.20.2B.20wf.html#205640894">(Jul 31 2020 at 20:58)</a>:</h4>
<p>the only design question I have is if we should invent placeholder syntax from the start, because untangling the constants in the where bounds from the types they are in seems messy and fragile (unless placeholder syntax means <code>[(), N]</code> where <code>N</code> can be any expression, so we just look for arrays of unit element type).</p>



<a name="205640936"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20equality%20%2B%20wf/near/205640936" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20equality.20.2B.20wf.html#205640936">(Jul 31 2020 at 20:59)</a>:</h4>
<p>"placeholder" syntax?</p>



<a name="205640976"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20equality%20%2B%20wf/near/205640976" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20equality.20.2B.20wf.html#205640976">(Jul 31 2020 at 20:59)</a>:</h4>
<p>well... there were ideas like <code>where {some expression}</code> or <code>where (some expression)</code></p>



<a name="205640996"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20equality%20%2B%20wf/near/205640996" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20equality.20.2B.20wf.html#205640996">(Jul 31 2020 at 20:59)</a>:</h4>
<p>which is sufficiently different from type syntax so we can just dump anon consts in where bounds</p>



<a name="205641060"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20equality%20%2B%20wf/near/205641060" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20equality.20.2B.20wf.html#205641060">(Jul 31 2020 at 21:00)</a>:</h4>
<p>but for an MVP using <code>[(); N]:</code> seems totally fine to me, so I we can ignore this</p>



<a name="205641082"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20equality%20%2B%20wf/near/205641082" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20equality.20.2B.20wf.html#205641082">(Jul 31 2020 at 21:00)</a>:</h4>
<p>Well, at least my idea was to just look at all anon consts in the public api for this</p>



<a name="205641095"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20equality%20%2B%20wf/near/205641095" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20equality.20.2B.20wf.html#205641095">(Jul 31 2020 at 21:00)</a>:</h4>
<p>that's the part that worries me ^^</p>



<a name="205641107"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20equality%20%2B%20wf/near/205641107" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20equality.20.2B.20wf.html#205641107">(Jul 31 2020 at 21:00)</a>:</h4>
<p>that's a very open list of things</p>



<a name="205641144"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20equality%20%2B%20wf/near/205641144" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20equality.20.2B.20wf.html#205641144">(Jul 31 2020 at 21:01)</a>:</h4>
<p>I don't want to spend time caring about syntax here <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span></p>



<a name="205641150"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20equality%20%2B%20wf/near/205641150" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20equality.20.2B.20wf.html#205641150">(Jul 31 2020 at 21:01)</a>:</h4>
<p>using the signature and some very explicit things seems ok, but if you start walking everything in the where bounds, idk what kind of implicit things we will encounter</p>



<a name="205641182"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20equality%20%2B%20wf/near/205641182" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20equality.20.2B.20wf.html#205641182">(Jul 31 2020 at 21:01)</a>:</h4>
<p>yea, that's why I mean "don't search recursively, just grab empty bounds on arrays of unit element type and use their length constants"</p>



<a name="205641237"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20equality%20%2B%20wf/near/205641237" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20equality.20.2B.20wf.html#205641237">(Jul 31 2020 at 21:02)</a>:</h4>
<p>if we don't have support for automatic detection of constants in the signature in the MVP that's totally fine</p>



<a name="205641276"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20equality%20%2B%20wf/near/205641276" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20equality.20.2B.20wf.html#205641276">(Jul 31 2020 at 21:02)</a>:</h4>
<p>also fine with me, don't think that's the interesting part here :)</p>



<a name="205641325"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20equality%20%2B%20wf/near/205641325" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20equality.20.2B.20wf.html#205641325">(Jul 31 2020 at 21:03)</a>:</h4>
<p>we may want to look into syntax before stabilizing this, but that's still quite far in the future</p>



<a name="205641383"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20equality%20%2B%20wf/near/205641383" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20equality.20.2B.20wf.html#205641383">(Jul 31 2020 at 21:04)</a>:</h4>
<p>as we depend on lazy norm for that</p>



<a name="205641400"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20equality%20%2B%20wf/near/205641400" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20equality.20.2B.20wf.html#205641400">(Jul 31 2020 at 21:04)</a>:</h4>
<p>which might be annoying to actually enable by default</p>



<a name="205641543"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20equality%20%2B%20wf/near/205641543" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20equality.20.2B.20wf.html#205641543">(Jul 31 2020 at 21:06)</a>:</h4>
<p>ok, so I guess from the feedback: impl it and keep the design document somewhere visible in the tracking issue?</p>



<a name="205641544"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20equality%20%2B%20wf/near/205641544" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20equality.20.2B.20wf.html#205641544">(Jul 31 2020 at 21:06)</a>:</h4>
<blockquote>
<p>because untangling the constants in the where bounds from the types they are in seems messy and fragile</p>
</blockquote>
<p>a small note here, I don't actually think this will be either messy or fragile, as it's probably "just" a <code>TypeVisitor</code>, but we will see that when implementing this</p>



<a name="205641577"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20equality%20%2B%20wf/near/205641577" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20equality.20.2B.20wf.html#205641577">(Jul 31 2020 at 21:06)</a>:</h4>
<p>I'm not worried about missing things, I'm worried about the <code>TypeVisitor</code> picking up things that we did not intend it to pick up</p>



<a name="205641619"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20equality%20%2B%20wf/near/205641619" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20equality.20.2B.20wf.html#205641619">(Jul 31 2020 at 21:07)</a>:</h4>
<p>do you have something specific in mind here, probably something like type aliases and stuff?</p>



<a name="205641631"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20equality%20%2B%20wf/near/205641631" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20equality.20.2B.20wf.html#205641631">(Jul 31 2020 at 21:07)</a>:</h4>
<p>or implied bounds?</p>



<a name="205641638"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20equality%20%2B%20wf/near/205641638" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20equality.20.2B.20wf.html#205641638">(Jul 31 2020 at 21:07)</a>:</h4>
<p>I was thinking generator or closure substs</p>



<a name="205641667"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20equality%20%2B%20wf/near/205641667" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20equality.20.2B.20wf.html#205641667">(Jul 31 2020 at 21:07)</a>:</h4>
<p>or associated types of trait bounds that aren't mentioned</p>



<a name="205641790"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20equality%20%2B%20wf/near/205641790" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20equality.20.2B.20wf.html#205641790">(Jul 31 2020 at 21:09)</a>:</h4>
<p><span aria-label="thumbs up" class="emoji emoji-1f44d" role="img" title="thumbs up">:thumbs_up:</span></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>